package com.shop2cn.iapi.member.testcase;

import java.math.BigDecimal;
import java.util.List;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.shop2cn.iapi.member.parameter.CreateMemberBean;
import com.shop2cn.iapi.member.parameter.MchMemberPointsListBean;
import com.shop2cn.iapi.member.parameter.MemberPointsDto;
import com.shop2cn.iapi.member.service.MchMemberPointsListCall;
import com.ymatou.iapi.dguser.parameter.UserCreateBean;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.*;
import com.ymt.utils.tag.*;
import com.ymttest.business.service.DGUserCallService;
import com.ymttest.business.service.GodMemberService;
import com.ymttest.business.service.shenqi.GodmchManageCallService;
import com.ymttest.utils.TestDataManager;
import com.ymttest.utils.YMTDateUtil;
/**
*商家会员积分列表
*FreeMaker Template自动生成代码
*/
@TestSuite
public class Ts_MchMemberPointsList{
	private static MchMemberPointsListBean mchmemberpointslistBean;
	private static MchMemberPointsListCall mchmemberpointslistCall;
	private static Integer shopid ;
	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("商家会员积分列表");
		try {
			shopid= GodmchManageCallService.CreateSellerMch();
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	@Before
	public void caseUp() {
		mchmemberpointslistBean=new MchMemberPointsListBean();
		mchmemberpointslistCall=new MchMemberPointsListCall();
	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(mchmemberpointslistCall.getOpurl());
	}

	@After
	public void caseDown() {
		Logger.end();
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_MchMemberPointsList_001() {
		Logger.start(true,"商家会员积分列表成功-送积分");
		try {
			shopid= GodmchManageCallService.CreateSellerMch();
			//创建一个新会员
			UserCreateBean usercreateBean = DGUserCallService.initUsercreateBean();
			int userId = DGUserCallService.UserCreateCall(usercreateBean);
			CreateMemberBean createMem = GodMemberService.initCreateMemberBean(shopid,userId,usercreateBean.getOpenId());
			createMem.setOpenId(usercreateBean.getOpenId());
			String memid = GodMemberService.creatememberCall(createMem);
			GodMemberService.mchSetOpenPoints(shopid, true);
			GodMemberService.MchSetOpenPointsRule(GodMemberService.initMchSetOpenPointsRuleBean(shopid));
//			GodMemberService.mchSetOpenPoints(GodMemberService.initSetPointsBean(shopid));
			Integer points=10;
			GodMemberService.sendPoints(memid, shopid, points);
//			mchmemberpointslistBean.setMemberId(memid);
			mchmemberpointslistBean.setShopId(shopid);
			mchmemberpointslistBean.setPageIndex(1);
			mchmemberpointslistBean.setPageSize(10);
			mchmemberpointslistCall.setData(mchmemberpointslistBean);
			mchmemberpointslistCall.callService();			
			Logger.verifyEquals("200", mchmemberpointslistCall.getString("code"), "验证code");
			//验证记录 送积分
			List<MemberPointsDto> results = mchmemberpointslistCall.getMemberPointsDtos();
			Logger.verifyEquals(1, results.size(), "验证条数");
			Logger.verifyEquals(200000, results.get(0).getBizType(),"验证getBizType");
			Logger.verifyEquals(points, results.get(0).getChangePoints(),"验证points");
			Logger.verifyEquals(memid, results.get(0).getMemberId(),"验证memid");
			Logger.verifyEquals("主账号", results.get(0).getOperator(),"验证getOperator");
			Logger.verifyEquals(null, results.get(0).getOrderAmt(),"验证getOrderAmt");
			Logger.verifyEquals(null, results.get(0).getOrderId(),"验证getOrderId");
			Logger.verifyEquals("atuoTest", results.get(0).getRemark(),"验证getRemark");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P2.class})
	@TestCase
	public void Tc_MchMemberPointsList_002() {
		Logger.start(true,"不输入pageindex失败");
		try {
			mchmemberpointslistBean.setShopId(shopid);
//			mchmemberpointslistBean.setPageIndex(1);
			mchmemberpointslistBean.setPageSize(10);
			mchmemberpointslistCall.setData(mchmemberpointslistBean);
			mchmemberpointslistCall.callService();			
			Logger.verifyEquals("400", mchmemberpointslistCall.getString("code"), "验证code");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P2.class})
	@TestCase
	public void Tc_MchMemberPointsList_003() {
		Logger.start(true,"不输入pagesize失败");
		try {
			mchmemberpointslistBean.setShopId(shopid);
			mchmemberpointslistBean.setPageIndex(1);
//			mchmemberpointslistBean.setPageSize(10);
			mchmemberpointslistCall.setData(mchmemberpointslistBean);
			mchmemberpointslistCall.callService();			
			Logger.verifyEquals("400", mchmemberpointslistCall.getString("code"), "验证code");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P2.class})
	@TestCase
	public void Tc_MchMemberPointsList_004() {
		Logger.start(true,"不输入shopid失败");
		try {
//			mchmemberpointslistBean.setShopId(shopid);
			mchmemberpointslistBean.setPageIndex(1);
			mchmemberpointslistBean.setPageSize(10);
			mchmemberpointslistCall.setData(mchmemberpointslistBean);
			mchmemberpointslistCall.callService();			
			Logger.verifyEquals("400", mchmemberpointslistCall.getString("code"), "验证code");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P2.class})
	@TestCase
	public void Tc_MchMemberPointsList_005() {
		Logger.start(true,"memberId搜索成功");
		try {
			//创建一个新会员
			UserCreateBean usercreateBean = DGUserCallService.initUsercreateBean();
			int userId = DGUserCallService.UserCreateCall(usercreateBean);
			CreateMemberBean createMem = GodMemberService.initCreateMemberBean(shopid,userId,usercreateBean.getOpenId());
			createMem.setOpenId(usercreateBean.getOpenId());
			String memid = GodMemberService.creatememberCall(createMem);
			GodMemberService.mchSetOpenPoints(shopid, true);
			GodMemberService.MchSetOpenPointsRule(GodMemberService.initMchSetOpenPointsRuleBean(shopid));
//			GodMemberService.mchSetOpenPoints(GodMemberService.initSetPointsBean(shopid));
			Integer points=10;
			GodMemberService.sendPoints(memid, shopid, points);
			mchmemberpointslistBean.setMemberId(memid);
			mchmemberpointslistBean.setShopId(shopid);
			mchmemberpointslistBean.setPageIndex(1);
			mchmemberpointslistBean.setPageSize(10);
			mchmemberpointslistCall.setData(mchmemberpointslistBean);
			mchmemberpointslistCall.callService();			
			Logger.verifyEquals("200", mchmemberpointslistCall.getString("code"), "验证code");
			//验证记录 送积分
			List<MemberPointsDto> results = mchmemberpointslistCall.getMemberPointsDtos();
			Logger.verifyEquals(1, results.size(), "验证条数");
			Logger.verifyEquals(200000, results.get(0).getBizType(),"验证getBizType");
			Logger.verifyEquals(points, results.get(0).getChangePoints(),"验证points");
			Logger.verifyEquals(memid, results.get(0).getMemberId(),"验证memid");
			Logger.verifyEquals("主账号", results.get(0).getOperator(),"验证getOperator");
			Logger.verifyEquals(null, results.get(0).getOrderAmt(),"验证getOrderAmt");
			Logger.verifyEquals(null, results.get(0).getOrderId(),"验证getOrderId");
			Logger.verifyEquals("atuoTest", results.get(0).getRemark(),"验证getRemark");
			
			mchmemberpointslistBean.setMemberId(memid+1);
			mchmemberpointslistCall.setData(mchmemberpointslistBean);
			mchmemberpointslistCall.callService();			
			Logger.verifyEquals("200", mchmemberpointslistCall.getString("code"), "验证code");
			Logger.verifyEquals(0, mchmemberpointslistCall.getTotal(), "验证条数");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P2.class})
	@TestCase
	public void Tc_MchMemberPointsList_006() {
		Logger.start(true,"nickName搜索成功");
		try {
			//创建一个新会员
			UserCreateBean usercreateBean = DGUserCallService.initUsercreateBean();
			String nickname="search"+TestDataManager.getRandomNum(5);
			usercreateBean.setNickname(nickname);
			int userId = DGUserCallService.UserCreateCall(usercreateBean);
			CreateMemberBean createMem = GodMemberService.initCreateMemberBean(shopid,userId,usercreateBean.getOpenId());
			createMem.setOpenId(usercreateBean.getOpenId());
			String memid = GodMemberService.creatememberCall(createMem);
			GodMemberService.mchSetOpenPoints(shopid, true);
			GodMemberService.MchSetOpenPointsRule(GodMemberService.initMchSetOpenPointsRuleBean(shopid));
//			GodMemberService.mchSetOpenPoints(GodMemberService.initSetPointsBean(shopid));
			Integer points=10;
			GodMemberService.sendPoints(memid, shopid, points);
			mchmemberpointslistBean.setNickName(nickname);
			mchmemberpointslistBean.setShopId(shopid);
			mchmemberpointslistBean.setPageIndex(1);
			mchmemberpointslistBean.setPageSize(10);
			mchmemberpointslistCall.setData(mchmemberpointslistBean);
			mchmemberpointslistCall.callService();			
			Logger.verifyEquals("200", mchmemberpointslistCall.getString("code"), "验证code");
			//验证记录 送积分
			List<MemberPointsDto> results = mchmemberpointslistCall.getMemberPointsDtos();
			Logger.verifyEquals(1, results.size(), "验证条数");
			Logger.verifyEquals(200000, results.get(0).getBizType(),"验证getBizType");
			Logger.verifyEquals(points, results.get(0).getChangePoints(),"验证points");
			Logger.verifyEquals(memid, results.get(0).getMemberId(),"验证memid");
			Logger.verifyEquals("主账号", results.get(0).getOperator(),"验证getOperator");
			Logger.verifyEquals(null, results.get(0).getOrderAmt(),"验证getOrderAmt");
			Logger.verifyEquals(null, results.get(0).getOrderId(),"验证getOrderId");
			Logger.verifyEquals("atuoTest", results.get(0).getRemark(),"验证getRemark");
			
			mchmemberpointslistBean.setNickName(nickname+1);
			mchmemberpointslistCall.setData(mchmemberpointslistBean);
			mchmemberpointslistCall.callService();			
			Logger.verifyEquals("200", mchmemberpointslistCall.getString("code"), "验证code");
			Logger.verifyEquals(0, mchmemberpointslistCall.getTotal(), "验证条数");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P2.class})
	@TestCase
	public void Tc_MchMemberPointsList_008() {
		Logger.start(true,"mobile搜索成功");
		try {
			//创建一个新会员
			UserCreateBean usercreateBean = DGUserCallService.initUsercreateBean();
			String nickname="search"+TestDataManager.getRandomNum(5);
			usercreateBean.setNickname(nickname);
			int userId = DGUserCallService.UserCreateCall(usercreateBean);
			CreateMemberBean createMem = GodMemberService.initCreateMemberBean(shopid,userId,usercreateBean.getOpenId());
			createMem.setOpenId(usercreateBean.getOpenId());
			String memid = GodMemberService.creatememberCall(createMem);
			GodMemberService.mchSetOpenPoints(shopid, true);
			GodMemberService.MchSetOpenPointsRule(GodMemberService.initMchSetOpenPointsRuleBean(shopid));
//			GodMemberService.mchSetOpenPoints(GodMemberService.initSetPointsBean(shopid));
			Integer points=10;
			GodMemberService.sendPoints(memid, shopid, points);
			String mobile=TestDataManager.getPhoneNum();
			GodMemberService.bindMobile(shopid, userId, mobile);
			mchmemberpointslistBean.setMobile(mobile);
			mchmemberpointslistBean.setShopId(shopid);
			mchmemberpointslistBean.setPageIndex(1);
			mchmemberpointslistBean.setPageSize(10);
			mchmemberpointslistCall.setData(mchmemberpointslistBean);
			mchmemberpointslistCall.callService();			
			Logger.verifyEquals("200", mchmemberpointslistCall.getString("code"), "验证code");
			//验证记录 送积分
			List<MemberPointsDto> results = mchmemberpointslistCall.getMemberPointsDtos();
			Logger.verifyEquals(1, results.size(), "验证条数");
			Logger.verifyEquals(200000, results.get(0).getBizType(),"验证getBizType");
			Logger.verifyEquals(points, results.get(0).getChangePoints(),"验证points");
			Logger.verifyEquals(memid, results.get(0).getMemberId(),"验证memid");
			Logger.verifyEquals("主账号", results.get(0).getOperator(),"验证getOperator");
			Logger.verifyEquals(null, results.get(0).getOrderAmt(),"验证getOrderAmt");
			Logger.verifyEquals(null, results.get(0).getOrderId(),"验证getOrderId");
			Logger.verifyEquals("atuoTest", results.get(0).getRemark(),"验证getRemark");
			
			mchmemberpointslistBean.setMobile(mobile+1);
			mchmemberpointslistCall.setData(mchmemberpointslistBean);
			mchmemberpointslistCall.callService();			
			Logger.verifyEquals("200", mchmemberpointslistCall.getString("code"), "验证code");
			Logger.verifyEquals(0, mchmemberpointslistCall.getTotal(), "验证条数");	
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P2.class})
	@TestCase
	public void Tc_MchMemberPointsList_009() {
		Logger.start(true,"bizType搜索成功");
		try {
			shopid= GodmchManageCallService.CreateSellerMch();
			//创建一个新会员
			UserCreateBean usercreateBean = DGUserCallService.initUsercreateBean();
			String nickname="search"+TestDataManager.getRandomNum(5);
			usercreateBean.setNickname(nickname);
			int userId = DGUserCallService.UserCreateCall(usercreateBean);
			CreateMemberBean createMem = GodMemberService.initCreateMemberBean(shopid,userId,usercreateBean.getOpenId());
			createMem.setOpenId(usercreateBean.getOpenId());
			String memid = GodMemberService.creatememberCall(createMem);
			GodMemberService.mchSetOpenPoints(shopid, true);
			GodMemberService.MchSetOpenPointsRule(GodMemberService.initMchSetOpenPointsRuleBean(shopid));
//			GodMemberService.mchSetOpenPoints(GodMemberService.initSetPointsBean(shopid));
			Integer points=10;
			GodMemberService.sendPoints(memid, shopid, points);
			String mobile=TestDataManager.getPhoneNum();
			GodMemberService.bindMobile(shopid, userId, mobile);
			mchmemberpointslistBean.setBizType(200000);
			mchmemberpointslistBean.setShopId(shopid);
			mchmemberpointslistBean.setPageIndex(1);
			mchmemberpointslistBean.setPageSize(10);
			mchmemberpointslistCall.setData(mchmemberpointslistBean);
			mchmemberpointslistCall.callService();			
			Logger.verifyEquals("200", mchmemberpointslistCall.getString("code"), "验证code");
			//验证记录 送积分
			List<MemberPointsDto> results = mchmemberpointslistCall.getMemberPointsDtos();
			Logger.verifyEquals(1, results.size(), "验证条数");
			Logger.verifyEquals(200000, results.get(0).getBizType(),"验证getBizType");
			Logger.verifyEquals(points, results.get(0).getChangePoints(),"验证points");
			Logger.verifyEquals(memid, results.get(0).getMemberId(),"验证memid");
			Logger.verifyEquals("主账号", results.get(0).getOperator(),"验证getOperator");
			Logger.verifyEquals(null, results.get(0).getOrderAmt(),"验证getOrderAmt");
			Logger.verifyEquals(null, results.get(0).getOrderId(),"验证getOrderId");
			Logger.verifyEquals("atuoTest", results.get(0).getRemark(),"验证getRemark");
			
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P2.class})
	@TestCase
	public void Tc_MchMemberPointsList_010() {
		Logger.start(true,"orderId搜索成功");
		try {
			//创建一个新会员
			UserCreateBean usercreateBean = DGUserCallService.initUsercreateBean();
			String nickname="search"+TestDataManager.getRandomNum(5);
			usercreateBean.setNickname(nickname);
			int userId = DGUserCallService.UserCreateCall(usercreateBean);
			CreateMemberBean createMem = GodMemberService.initCreateMemberBean(shopid,userId,usercreateBean.getOpenId());
			createMem.setOpenId(usercreateBean.getOpenId());
			String memid = GodMemberService.creatememberCall(createMem);
			GodMemberService.mchSetOpenPoints(shopid, true);
			GodMemberService.MchSetOpenPointsRule(GodMemberService.initMchSetOpenPointsRuleBean(shopid));
			//来一笔支付
			Long orderid=Long.valueOf(TestDataManager.getRandomNum(10));
			String sqOrderRmbAmount="1000";
			GodMemberService.processOrderPay(userId, shopid, orderid, sqOrderRmbAmount);
//			GodMemberService.mchSetOpenPoints(GodMemberService.initSetPointsBean(shopid));
			
			Integer points=10;
			GodMemberService.sendPoints(memid, shopid, points);
			String mobile=TestDataManager.getPhoneNum();
			GodMemberService.bindMobile(shopid, userId, mobile);
			mchmemberpointslistBean.setOrderId(orderid);
			mchmemberpointslistBean.setShopId(shopid);
			mchmemberpointslistBean.setPageIndex(1);
			mchmemberpointslistBean.setPageSize(10);
			mchmemberpointslistCall.setData(mchmemberpointslistBean);
			mchmemberpointslistCall.callService();			
			Logger.verifyEquals("200", mchmemberpointslistCall.getString("code"), "验证code");
			//验证记录 送积分
			List<MemberPointsDto> results = mchmemberpointslistCall.getMemberPointsDtos();
			Logger.verifyEquals(1, results.size(), "验证条数");
			Logger.verifyEquals(100000, results.get(0).getBizType(),"验证getBizType");
			Logger.verifyEquals(50, results.get(0).getChangePoints(),"验证points");
			Logger.verifyEquals(memid, results.get(0).getMemberId(),"验证memid");
			Logger.verifyEquals("系统", results.get(0).getOperator(),"验证getOperator");
			Logger.verifyEquals(new BigDecimal(sqOrderRmbAmount).setScale(2), new BigDecimal(results.get(0).getOrderAmt()).setScale(2),"验证getOrderAmt");
			Logger.verifyEquals(orderid, results.get(0).getOrderId(),"验证getOrderId");
			Logger.verifyEquals("下单送积分", results.get(0).getRemark(),"验证getRemark");
			
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P2.class})
	@TestCase
	public void Tc_MchMemberPointsList_011() {
		Logger.start(true,"orderTime条件搜索成功");
		try {
			shopid= GodmchManageCallService.CreateSellerMch();
			//创建一个新会员
			UserCreateBean usercreateBean = DGUserCallService.initUsercreateBean();
			String nickname="search"+TestDataManager.getRandomNum(5);
			usercreateBean.setNickname(nickname);
			int userId = DGUserCallService.UserCreateCall(usercreateBean);
			CreateMemberBean createMem = GodMemberService.initCreateMemberBean(shopid,userId,usercreateBean.getOpenId());
			createMem.setOpenId(usercreateBean.getOpenId());
			String memid = GodMemberService.creatememberCall(createMem);
			GodMemberService.mchSetOpenPoints(shopid, true);
			GodMemberService.MchSetOpenPointsRule(GodMemberService.initMchSetOpenPointsRuleBean(shopid));
			//来一笔支付
			Long orderid=Long.valueOf(TestDataManager.getRandomNum(10));
			String sqOrderRmbAmount="1000";
			GodMemberService.processOrderPay(userId, shopid, orderid, sqOrderRmbAmount);
//			GodMemberService.mchSetOpenPoints(GodMemberService.initSetPointsBean(shopid));
			
			Integer points=10;
			GodMemberService.sendPoints(memid, shopid, points);
			String mobile=TestDataManager.getPhoneNum();
			GodMemberService.bindMobile(shopid, userId, mobile);
			mchmemberpointslistBean.setOrderTime(YMTDateUtil.getBeforeOrNextDay(0));
			mchmemberpointslistBean.setShopId(shopid);
			mchmemberpointslistBean.setPageIndex(1);
			mchmemberpointslistBean.setPageSize(10);
			mchmemberpointslistCall.setData(mchmemberpointslistBean);
			mchmemberpointslistCall.callService();			
			Logger.verifyEquals("200", mchmemberpointslistCall.getString("code"), "验证code");
			//验证记录 送积分
			List<MemberPointsDto> results = mchmemberpointslistCall.getMemberPointsDtos();
			Logger.verifyEquals(2, results.size(), "验证条数");
			MemberPointsDto result = results.stream().filter(x->{return x.getBizType().equals(100000);}).findFirst().get();
			Logger.verifyEquals(100000, result.getBizType(),"验证getBizType");
			Logger.verifyEquals(50, result.getChangePoints(),"验证points");
			Logger.verifyEquals(memid, result.getMemberId(),"验证memid");
			Logger.verifyEquals("系统", result.getOperator(),"验证getOperator");
			Logger.verifyEquals(new BigDecimal(sqOrderRmbAmount).setScale(2), new BigDecimal(result.getOrderAmt()).setScale(2),"验证getOrderAmt");
			Logger.verifyEquals(orderid, result.getOrderId(),"验证getOrderId");
			Logger.verifyEquals("下单送积分", result.getRemark(),"验证getRemark");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P2.class})
	@TestCase
	public void Tc_MchMemberPointsList_012() {
		Logger.start(true,"remark搜索成功");
		try {
			shopid= GodmchManageCallService.CreateSellerMch();
			//创建一个新会员
			UserCreateBean usercreateBean = DGUserCallService.initUsercreateBean();
			String nickname="search"+TestDataManager.getRandomNum(5);
			usercreateBean.setNickname(nickname);
			int userId = DGUserCallService.UserCreateCall(usercreateBean);
			CreateMemberBean createMem = GodMemberService.initCreateMemberBean(shopid,userId,usercreateBean.getOpenId());
			createMem.setOpenId(usercreateBean.getOpenId());
			String memid = GodMemberService.creatememberCall(createMem);
			GodMemberService.mchSetOpenPoints(shopid, true);
			GodMemberService.MchSetOpenPointsRule(GodMemberService.initMchSetOpenPointsRuleBean(shopid));
			//来一笔支付
			Long orderid=Long.valueOf(TestDataManager.getRandomNum(10));
			String sqOrderRmbAmount="1000";
			GodMemberService.processOrderPay(userId, shopid, orderid, sqOrderRmbAmount);
//			GodMemberService.mchSetOpenPoints(GodMemberService.initSetPointsBean(shopid));
			
			Integer points=10;
			GodMemberService.sendPoints(memid, shopid, points);
			String mobile=TestDataManager.getPhoneNum();
			GodMemberService.bindMobile(shopid, userId, mobile);
			mchmemberpointslistBean.setRemark("下单送积分");
			mchmemberpointslistBean.setShopId(shopid);
			mchmemberpointslistBean.setPageIndex(1);
			mchmemberpointslistBean.setPageSize(10);
			mchmemberpointslistCall.setData(mchmemberpointslistBean);
			mchmemberpointslistCall.callService();			
			Logger.verifyEquals("200", mchmemberpointslistCall.getString("code"), "验证code");
			//验证记录 送积分
			List<MemberPointsDto> results = mchmemberpointslistCall.getMemberPointsDtos();
			Logger.verifyEquals(1, results.size(), "验证条数");
			Logger.verifyEquals(100000, results.get(0).getBizType(),"验证getBizType");
			Logger.verifyEquals(50, results.get(0).getChangePoints(),"验证points");
			Logger.verifyEquals(memid, results.get(0).getMemberId(),"验证memid");
			Logger.verifyEquals("系统", results.get(0).getOperator(),"验证getOperator");
			Logger.verifyEquals(new BigDecimal(sqOrderRmbAmount).setScale(2), new BigDecimal(results.get(0).getOrderAmt()).setScale(2),"验证getOrderAmt");
			Logger.verifyEquals(orderid, results.get(0).getOrderId(),"验证getOrderId");
			Logger.verifyEquals("下单送积分", results.get(0).getRemark(),"验证getRemark");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P2.class})
	@TestCase
	public void Tc_MchMemberPointsList_013() {
		Logger.start(true,"商家会员积分列表成功,amountSort=true金额正序");
		try {
			shopid= GodmchManageCallService.CreateSellerMch();
			//创建一个新会员
			UserCreateBean usercreateBean = DGUserCallService.initUsercreateBean();
			String nickname="search"+TestDataManager.getRandomNum(5);
			usercreateBean.setNickname(nickname);
			int userId = DGUserCallService.UserCreateCall(usercreateBean);
			CreateMemberBean createMem = GodMemberService.initCreateMemberBean(shopid,userId,usercreateBean.getOpenId());
			createMem.setOpenId(usercreateBean.getOpenId());
			String memid = GodMemberService.creatememberCall(createMem);
			GodMemberService.mchSetOpenPoints(shopid, true);
			GodMemberService.MchSetOpenPointsRule(GodMemberService.initMchSetOpenPointsRuleBean(shopid));
			//来一笔支付
			Long orderid=Long.valueOf(TestDataManager.getRandomNum(10));
			String sqOrderRmbAmount="1000";
			GodMemberService.processOrderPay(userId, shopid, orderid, sqOrderRmbAmount);
//			GodMemberService.mchSetOpenPoints(GodMemberService.initSetPointsBean(shopid));
			
			Integer points=10;
			GodMemberService.sendPoints(memid, shopid, points);
			String mobile=TestDataManager.getPhoneNum();
			GodMemberService.bindMobile(shopid, userId, mobile);
			mchmemberpointslistBean.setAmountSort(false);
			mchmemberpointslistBean.setShopId(shopid);
			mchmemberpointslistBean.setPageIndex(1);
			mchmemberpointslistBean.setPageSize(10);
			mchmemberpointslistCall.setData(mchmemberpointslistBean);
			mchmemberpointslistCall.callService();			
			Logger.verifyEquals("200", mchmemberpointslistCall.getString("code"), "验证code");
			//验证记录 送积分
			List<MemberPointsDto> results = mchmemberpointslistCall.getMemberPointsDtos();
			Logger.verifyEquals(2, results.size(), "验证条数");
			Logger.verifyEquals(100000, results.get(0).getBizType(),"验证getBizType");
			Logger.verifyEquals(50, results.get(0).getChangePoints(),"验证points");
			Logger.verifyEquals(memid, results.get(0).getMemberId(),"验证memid");
			Logger.verifyEquals("系统", results.get(0).getOperator(),"验证getOperator");
			Logger.verifyEquals(new BigDecimal(sqOrderRmbAmount).setScale(2), new BigDecimal(results.get(0).getOrderAmt()).setScale(2),"验证getOrderAmt");
			Logger.verifyEquals(orderid, results.get(0).getOrderId(),"验证getOrderId");
			Logger.verifyEquals("下单送积分", results.get(0).getRemark(),"验证getRemark");
			
			mchmemberpointslistBean.setAmountSort(true);
			mchmemberpointslistCall.callService();			
			Logger.verifyEquals("200", mchmemberpointslistCall.getString("code"), "验证code");
			results = mchmemberpointslistCall.getMemberPointsDtos();
			Logger.verifyEquals(2, results.size(), "验证条数");
			Logger.verifyEquals(100000, results.get(1).getBizType(),"验证getBizType");
			Logger.verifyEquals(50, results.get(1).getChangePoints(),"验证points");
			Logger.verifyEquals(memid, results.get(1).getMemberId(),"验证memid");
			Logger.verifyEquals("系统", results.get(1).getOperator(),"验证getOperator");
			Logger.verifyEquals(new BigDecimal(sqOrderRmbAmount).setScale(2), new BigDecimal(results.get(1).getOrderAmt()).setScale(2),"验证getOrderAmt");
			Logger.verifyEquals(orderid, results.get(1).getOrderId(),"验证getOrderId");
			Logger.verifyEquals("下单送积分", results.get(1).getRemark(),"验证getRemark");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P2.class})
	@TestCase
	@Ignore
	//参考case13
	public void Tc_MchMemberPointsList_014() {
		Logger.start(true,"商家会员积分列表成功,amountSort=false金额倒叙");
		try {
			org.junit.Assert.fail();
			mchmemberpointslistCall.setData(mchmemberpointslistBean);
			mchmemberpointslistCall.callService();			
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P2.class})
	@TestCase
	public void Tc_MchMemberPointsList_015() {
		Logger.start(true,"商家会员积分列表成功,orderTimeSort=true下单时间排序正序");
		try {
			shopid= GodmchManageCallService.CreateSellerMch();
			//创建一个新会员
			UserCreateBean usercreateBean = DGUserCallService.initUsercreateBean();
			String nickname="search"+TestDataManager.getRandomNum(5);
			usercreateBean.setNickname(nickname);
			int userId = DGUserCallService.UserCreateCall(usercreateBean);
			CreateMemberBean createMem = GodMemberService.initCreateMemberBean(shopid,userId,usercreateBean.getOpenId());
			createMem.setOpenId(usercreateBean.getOpenId());
			String memid = GodMemberService.creatememberCall(createMem);
			GodMemberService.mchSetOpenPoints(shopid, true);
			GodMemberService.MchSetOpenPointsRule(GodMemberService.initMchSetOpenPointsRuleBean(shopid));
			//来一笔支付
			Long orderid=Long.valueOf(TestDataManager.getRandomNum(10));
			String sqOrderRmbAmount="1000";
			GodMemberService.processOrderPay(userId, shopid, orderid, sqOrderRmbAmount);
//			GodMemberService.mchSetOpenPoints(GodMemberService.initSetPointsBean(shopid));
			
			Integer points=10;
			GodMemberService.sendPoints(memid, shopid, points);
			String mobile=TestDataManager.getPhoneNum();
			GodMemberService.bindMobile(shopid, userId, mobile);
			mchmemberpointslistBean.setOrderTimeSort(false);
			mchmemberpointslistBean.setShopId(shopid);
			mchmemberpointslistBean.setPageIndex(1);
			mchmemberpointslistBean.setPageSize(10);
			mchmemberpointslistCall.setData(mchmemberpointslistBean);
			mchmemberpointslistCall.callService();			
			Logger.verifyEquals("200", mchmemberpointslistCall.getString("code"), "验证code");
			//验证记录 送积分
			List<MemberPointsDto> results = mchmemberpointslistCall.getMemberPointsDtos();
			Logger.verifyEquals(2, results.size(), "验证条数");
			MemberPointsDto result = results.stream().filter(x->{return x.getBizType().equals(100000);}).findFirst().get();
			Logger.verifyEquals(100000, result.getBizType(),"验证getBizType");
			Logger.verifyEquals(50, result.getChangePoints(),"验证points");
			Logger.verifyEquals(memid, result.getMemberId(),"验证memid");
			Logger.verifyEquals("系统", result.getOperator(),"验证getOperator");
			Logger.verifyEquals(new BigDecimal(sqOrderRmbAmount).setScale(2), new BigDecimal(result.getOrderAmt()).setScale(2),"验证getOrderAmt");
			Logger.verifyEquals(orderid, result.getOrderId(),"验证getOrderId");
			Logger.verifyEquals("下单送积分", result.getRemark(),"验证getRemark");
			
			mchmemberpointslistBean.setOrderTimeSort(true);
			mchmemberpointslistCall.callService();			
			Logger.verifyEquals("200", mchmemberpointslistCall.getString("code"), "验证code");
			results = mchmemberpointslistCall.getMemberPointsDtos();
			Logger.verifyEquals(2, results.size(), "验证条数");
			result = results.stream().filter(x->{return x.getBizType().equals(100000);}).findFirst().get();
			Logger.verifyEquals(100000,result.getBizType(),"验证getBizType");
			Logger.verifyEquals(50, result.getChangePoints(),"验证points");
			Logger.verifyEquals(memid,result.getMemberId(),"验证memid");
			Logger.verifyEquals("系统", result.getOperator(),"验证getOperator");
			Logger.verifyEquals(new BigDecimal(sqOrderRmbAmount).setScale(2), new BigDecimal(result.getOrderAmt()).setScale(2),"验证getOrderAmt");
			Logger.verifyEquals(orderid, result.getOrderId(),"验证getOrderId");
			Logger.verifyEquals("下单送积分", result.getRemark(),"验证getRemark");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P2.class})
	@TestCase
	@Ignore
	//参考case153
	public void Tc_MchMemberPointsList_016() {
		Logger.start(true,"商家会员积分列表成功,orderTimeSort=false下单时间排序倒叙");
		try {
			org.junit.Assert.fail();
			mchmemberpointslistCall.setData(mchmemberpointslistBean);
			mchmemberpointslistCall.callService();			
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_MchMemberPointsList_017() {
		Logger.start(true,"商家会员积分列表成功-支付");
		try {
			shopid= GodmchManageCallService.CreateSellerMch();
			//创建一个新会员
			UserCreateBean usercreateBean = DGUserCallService.initUsercreateBean();
			int userId = DGUserCallService.UserCreateCall(usercreateBean);
			CreateMemberBean createMem = GodMemberService.initCreateMemberBean(shopid,userId,usercreateBean.getOpenId());
			createMem.setOpenId(usercreateBean.getOpenId());
			String memid = GodMemberService.creatememberCall(createMem);
			GodMemberService.mchSetOpenPoints(shopid, true);
			GodMemberService.MchSetOpenPointsRule(GodMemberService.initMchSetOpenPointsRuleBean(shopid));
			//订单的points是算出来的 提前算好100=5
			Integer points=5;
//			GodMemberService.sendPoints(memid, shopid, points);
			Long orderid=Long.valueOf(TestDataManager.getRandomNum(10));
			String sqOrderRmbAmount="101";
			GodMemberService.processOrderPay(userId, shopid, orderid, sqOrderRmbAmount);
			mchmemberpointslistBean.setMemberId(memid);
			mchmemberpointslistBean.setShopId(shopid);
			mchmemberpointslistBean.setPageIndex(1);
			mchmemberpointslistBean.setPageSize(10);
			mchmemberpointslistCall.setData(mchmemberpointslistBean);
			mchmemberpointslistCall.callService();			
			Logger.verifyEquals("200", mchmemberpointslistCall.getString("code"), "验证code");
			//验证记录 送积分
			List<MemberPointsDto> results = mchmemberpointslistCall.getMemberPointsDtos();
			Logger.verifyEquals(1, results.size(), "验证条数");
			Logger.verifyEquals(100000, results.get(0).getBizType(),"验证getBizType");
			Logger.verifyEquals(points, results.get(0).getChangePoints(),"验证points");
			Logger.verifyEquals(memid, results.get(0).getMemberId(),"验证memid");
			Logger.verifyEquals("系统", results.get(0).getOperator(),"验证getOperator");
			Logger.verifyEquals(new BigDecimal(sqOrderRmbAmount).setScale(2),new BigDecimal( results.get(0).getOrderAmt()).setScale(2),"验证getOrderAmt");
			Logger.verifyEquals(orderid, results.get(0).getOrderId(),"验证getOrderId");
			Logger.verifyEquals("下单送积分", results.get(0).getRemark(),"验证getRemark");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_MchMemberPointsList_018() {
		Logger.start(true,"商家会员积分列表成功-扣积分");
		try {
			shopid= GodmchManageCallService.CreateSellerMch();
			//创建一个新会员
			UserCreateBean usercreateBean = DGUserCallService.initUsercreateBean();
			int userId = DGUserCallService.UserCreateCall(usercreateBean);
			CreateMemberBean createMem = GodMemberService.initCreateMemberBean(shopid,userId,usercreateBean.getOpenId());
			createMem.setOpenId(usercreateBean.getOpenId());
			String memid = GodMemberService.creatememberCall(createMem);
			GodMemberService.mchSetOpenPoints(shopid, true);
			GodMemberService.MchSetOpenPointsRule(GodMemberService.initMchSetOpenPointsRuleBean(shopid));
			Integer points=10;
			Integer dpoints=-6;
			GodMemberService.sendPoints(memid, shopid, points);
			GodMemberService.sendPoints(memid, shopid, dpoints);
			mchmemberpointslistBean.setMemberId(memid);
			mchmemberpointslistBean.setShopId(shopid);
			mchmemberpointslistBean.setPageIndex(1);
			mchmemberpointslistBean.setPageSize(10);
			mchmemberpointslistCall.setData(mchmemberpointslistBean);
			mchmemberpointslistCall.callService();			
			Logger.verifyEquals("200", mchmemberpointslistCall.getString("code"), "验证code");
			///验证记录 送积分
			List<MemberPointsDto> results = mchmemberpointslistCall.getMemberPointsDtos();
			Logger.verifyEquals(2, results.size(), "验证条数");
			MemberPointsDto result = results.stream().filter(x->{return x.getBizType().equals(210000);}).findFirst().get();
			Logger.verifyEquals(210000, result.getBizType(),"验证getBizType");
			Logger.verifyEquals(dpoints, result.getChangePoints(),"验证points");
			Logger.verifyEquals(memid, result.getMemberId(),"验证memid");
			Logger.verifyEquals("主账号",result.getOperator(),"验证getOperator");
			Logger.verifyEquals(null, result.getOrderAmt(),"验证getOrderAmt");
			Logger.verifyEquals(null, result.getOrderId(),"验证getOrderId");
			Logger.verifyEquals("atuoTest", result.getRemark(),"验证getRemark");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_MchMemberPointsList_019() {
		Logger.start(true,"商家会员积分列表成功-取消支付");
		try {
			shopid= GodmchManageCallService.CreateSellerMch();
			//创建一个新会员
			UserCreateBean usercreateBean = DGUserCallService.initUsercreateBean();
			int userId = DGUserCallService.UserCreateCall(usercreateBean);
			CreateMemberBean createMem = GodMemberService.initCreateMemberBean(shopid,userId,usercreateBean.getOpenId());
			createMem.setOpenId(usercreateBean.getOpenId());
			String memid = GodMemberService.creatememberCall(createMem);
			GodMemberService.mchSetOpenPoints(shopid, true);
			GodMemberService.MchSetOpenPointsRule(GodMemberService.initMchSetOpenPointsRuleBean(shopid));
			//订单的points是算出来的 提前算好100=5
			Integer points=5;
//			GodMemberService.sendPoints(memid, shopid, points);
			Long orderid=Long.valueOf(TestDataManager.getRandomNum(10));
			String sqOrderRmbAmount="101";
			GodMemberService.processOrderPay(userId, shopid, orderid, sqOrderRmbAmount);
			GodMemberService.processOrderCancelPay(userId, shopid, orderid,101);
			mchmemberpointslistBean.setMemberId(memid);
			mchmemberpointslistBean.setShopId(shopid);
			mchmemberpointslistBean.setPageIndex(1);
			mchmemberpointslistBean.setPageSize(10);
			mchmemberpointslistCall.setData(mchmemberpointslistBean);
			mchmemberpointslistCall.callService();			
			Logger.verifyEquals("200", mchmemberpointslistCall.getString("code"), "验证code");
			///验证记录 送积分
			List<MemberPointsDto> results = mchmemberpointslistCall.getMemberPointsDtos();
			Logger.verifyEquals(2, results.size(), "验证条数");
			MemberPointsDto result = results.stream().filter(x->{return x.getBizType().equals(110000);}).findFirst().get();
			Logger.verifyEquals(110000, result.getBizType(),"验证getBizType");
			Logger.verifyEquals(-points, result.getChangePoints(),"验证points");
			Logger.verifyEquals(memid, result.getMemberId(),"验证memid");
			Logger.verifyEquals("系统", result.getOperator(),"验证getOperator");
			Logger.verifyEquals(new BigDecimal(sqOrderRmbAmount).setScale(2),new BigDecimal( result.getOrderAmt()).setScale(2),"验证getOrderAmt");
			Logger.verifyEquals(orderid,result.getOrderId(),"验证getOrderId");
			Logger.verifyEquals("退款扣积分", result.getRemark(),"验证getRemark");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
}